{{define "admin/login-header"}}
<!--[if lt IE 9]>
<meta http-equiv="refresh" content="0;ie.html"/>
<![endif]-->
<script>if (window.top !== window.self) {
    window.top.location = window.location;
}</script>
{{end}}


<body class="gray-bg">
<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <div>

            <h1 class="logo-name">H+</h1>

        </div>
        <h3>欢迎使用 H+</h3>

        <form class="m-t" role="form">
            <div class="form-group">
                <input type="text" class="form-control" placeholder="用户名" required="" id="username">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" placeholder="密码" required="" id="password">
            </div>
            <button type="button" class="btn btn-primary block full-width m-b" id="login">登 录</button>

            <p class="text-muted text-center"><a href="login.html#">
                <small>忘记密码了？</small>
            </a> | <a href="register.html">注册一个新账号</a>
            </p>

        </form>
    </div>
</div>
</body>


{{define "admin/login-footer"}}
<script>
    $(function () {
        $(document).on('click', '#login', function () {

            $.ajax({
                type: 'post',
                url: '/admin/auth/login',
                data: {username: $("#username").val(), password: $("#password").val()},
                success: function (result) {
                    if (result.status) {
                        layer.alert(result.message, {icon: 6}, function () {
                            window.location.href = '/admin/auth';
                        });

                    } else {
                        layer.alert(result.message, {icon: 5})
                    }
                }
            });
        })
    })
</script>
{{end}}
